// Server-side Code

// Define actions which can be called from the client using ss.rpc('demo.ACTIONNAME', param1, param2...)
var key = 0
exports.add = function(element) {
	element.key = key++

	var timestamp = function() {
	  var d = new Date();
	    var pad2 = function(number) {
	      return (number < 10 ? '0' : '') + number;
	    };
	  return d.getHours() + ':' + pad2(d.getMinutes()) + ':' + pad2(d.getSeconds());
	};


	element.date = timestamp();

    return element
}

exports.elements = function(key) {
    if(key == '1_personal')
    return [
        {
            id: 1,
            message: 'Президент',
            date: 123
        },
        {
            id: 2,
            message: 'зубочист',
            date: 123
        },
        {
            id: 3,
            message: 'дантист',
            date: 123
        },
        {
            id: 4,
            message: 'баптист',
            date: 123
        },
        {
            id: 5,
            message: 'повар',
            date: 123
        },
        {
            id: 6,
            message: 'директор',
            date: 123
        },
    ]
    return [
        {
            id: 5,
            message: 'повар',
            date: 123
        },
        {
            id: 6,
            message: 'директор',
            date: 123
        },
    ]
}


